<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>本地通道登录</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <link rel="shortcut icon" href="{:request()->domain()}/favicon.ico" />
    <link rel="stylesheet" href="{:request()->domain()}/assets/css/element-plus.css" />
    <link rel="stylesheet" href="{:request()->domain()}/assets/libs/font-awesome/css/font-awesome.min.css" />
    <script src="{:request()->domain()}/assets/js/vue.global.js" type="text/javascript"></script>
    <script src="{:request()->domain()}/assets/js/axios.min.js" type="text/javascript"></script>
    <script src="{:request()->domain()}/assets/js/element-plus.js" type="text/javascript"></script>
    <style>
        body {
            margin: 0;
            padding: 0;
            background-color: #f5f5f5;
        }
        .page-contaier{
            background-color: var(--el-bg-color-page);
            position: fixed;
            left: 0;
            right: 0;
            top: 0;
            bottom: 0;
            display: flex;
            align-items: center;
            justify-content: center;
        }
    </style>
</head>
<body>
<div id="app">
    <el-container id="container">
        <el-main>
            <div class="page-contaier">
                <el-card shadow="never"  header="请输入监控密码：" style="width: 400px;position: relative;top: -20px">
                    <el-input size="large" type="password" v-model="password" placeholder="请输入监控密码"></el-input>
                    <el-button @click="login" size="large" style="margin-top: 15px;width: 100%" type="primary">确认</el-button>
                </el-card>
            </div>
        </el-main>
    </el-container>
</div>
</body>
<script type="module">
    import zhcn from '{:request()->domain()}/assets/js/zh-cn.js';
    import {requestPost} from '{:request()->domain()}/assets/js/sentrybox.js';
    const apiHost='{$apiHost}';
    const app = Vue.createApp({
        data() {
            return {
                password:''
            }
        },
        mounted:function (){
            localStorage.setItem('token','');
            localStorage.setItem('uniqid','{$uniqid}');
            localStorage.setItem('apiHost',apiHost);
        },
        methods:{
            login:function (){
                requestPost('index/login',{password:this.password,uniqid:'{$uniqid}'}).then(res=>{
                    localStorage.setItem('token',res.token);
                    location.href='/index';
                });
            }
        }
    })
    app.use(ElementPlus, {locale: zhcn});
    app.mount('#app')
</script>
</html>